@return: domain objects
"""
+ self.refresh()
return self.domains.values()
-
+
+ def list_sorted(self):
+ """Get list of domain objects, sorted by name.
+
+ @return: domain objects
+ """
+ doms = self.list()
+ doms.sort(lambda x, y: cmp(x.name, y.name))
+ return doms
+
+ def list_names(self):
+ """Get list of domain names.
+
+ @return: domain names
+ """
+ doms = self.list_sorted()
+ return map(lambda x: x.name, doms)
+
def onVirq(self, event, val):
"""Event handler for virq.
"""
else:
self._delete_domain(id)
- def domain_ls(self):
- """Get list of domain names.
-
- @return: domain names
- """
- self.refresh()
- doms = self.domains.values()
- doms.sort(lambda x, y: cmp(x.name, y.name))
- return map(lambda x: x.name, doms)
-
- def domain_ls_ids(self):
- """Get list of domain ids.
-
- @return: domain names
- """
- self.refresh()
- return self.domains.keys()
-
def domain_create(self, config):
"""Create a domain from a configuration.
if not url.endswith('/'):
url += '/'
if use_sxp:
- domains = self.xd.domain_ls()
+ domains = self.xd.list_names()
sxp.show(domains, out=req)
else:
- domains = self.xd.list()
- domains.sort(lambda x, y: cmp(x.name, y.name))
+ domains = self.xd.list_sorted()
req.write('<ul>')
for d in domains:
req.write('<li><a href="%s%s"> Domain %s</a>'
def op_domain_ls(self, name, v):
xd = xroot.get_component("xen.xend.XendDomain")
- return xd.domain_ls()
+ return xd.list_names()
def op_domain_configure(self, name, v):
domid = sxp.child_value(v, "dom")